package org.fengling.readingplatform.pay.factory;

import org.fengling.readingplatform.pay.template.AbstractPaymentHandler;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class PaymentFactory {

    // 定义策略map缓存
    public static Map<String, AbstractPaymentHandler> strategyMap = new ConcurrentHashMap<>();

    public static AbstractPaymentHandler getInvokeStrategy(String str){
        return strategyMap.get(str);
    }

    public static void register(String str, AbstractPaymentHandler handler){
        if(null == str || null == handler){
            return ;
        }
        strategyMap.put(str, handler);
    }

}
